#include "Bullet.h"

Bullet::Bullet(bool hero) : isHero(hero)
{
    if(isHero) {
        bullet.load(BULLET1_PATH);
        speed = BULLET_SPEED;
    } else {
        bullet.load(BULLET2_PATH);
        speed = -BULLET_SPEED;
    }
    isFree = true;
}

void Bullet::updatePosition()
{
    if(isFree) return;

    y += speed;

    if(y <= -bullet.height() || y >= GAME_HEIGHT) {
        isFree = true;
    }
}
